package com.xiang.sql.mapper;

import com.xiang.sql.entity.OrderStock;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
 * 非消费单 Mapper 接口
 * 
 * @author mac-xiang
 */
public interface OrderStockMapper extends BaseMapper<OrderStock> {
  @Select({
      "SELECT a.*, d.name in_gid_name, c.name create_name,b.name out_gid_name",
      "FROM `order_stock` a",
      "LEFT JOIN `user` c ON c.id = a.`create`",
      "LEFT JOIN `group` d ON d.id = a.`in_gid`",
      "LEFT JOIN `group` b ON b.id = a.`out_gid`",
      "${ew.customSqlSegment}"
  })
  List<OrderStock> selectList2(@Param("ew") Wrapper<OrderStock> queryWrapper);

  @Select({
  "SELECT COUNT(*) AS total FROM `order_stock` a",
  "${ew.customSqlSegment}"
  })
  Long count(@Param("ew") Wrapper<OrderStock> queryWrapper);

}